home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / graphics / gnuplot / term / tek.trm < prev    next >
Text File  |  1993-09-15  |  7KB  |  365 lines

  1. /*
  2.  * $Id: tek.trm%v 3.50 1993/07/09 05:35:24 woo Exp $
  3.  *
  4.  */
  5.  
  6. /* GNUPLOT - tek.trm */
  7. /*
  8.  * Copyright (C) 1990 - 1993   
  9.  *
  10.  * Permission to use, copy, and distribute this software and its
  11.  * documentation for any purpose with or without fee is hereby granted, 
  12.  * provided that the above copyright notice appear in all copies and 
  13.  * that both that copyright notice and this permission notice appear 
  14.  * in supporting documentation.
  15.  *
  16.  * Permission to modify the software is granted, but not the right to
  17.  * distribute the modified code.  Modifications are to be distributed 
  18.  * as patches to released version.
  19.  *  
  20.  * This software  is provided "as is" without express or implied warranty.
  21.  * 
  22.  * This file is included by ../term.c.
  23.  *
  24.  * This terminal driver supports:
  25.  *  tek40xx, bitgraph, kermit_color_tek40xx, kermit_mono_tek40xx, selanar
  26.  *  ln03plus
  27.  *
  28.  * AUTHORS
  29.  *   Colin Kelley, Thomas Williams, Russell Lang
  30.  * 
  31.  * send your comments or suggestions to (info-gnuplot@dartmouth.edu).
  32.  * 
  33.  */
  34.  
  35. #ifdef TEK
  36.  
  37. #define TEK40XMAX 1024
  38. #define TEK40YMAX 780
  39.  
  40. #define TEK40XLAST (TEK40XMAX - 1)
  41. #define TEK40YLAST (TEK40YMAX - 1)
  42.  
  43. #define TEK40VCHAR        25
  44. #define TEK40HCHAR        14
  45. #define TEK40VTIC        11
  46. #define TEK40HTIC        11    
  47.  
  48. #define HX 0x20        /* bit pattern to OR over 5-bit data */
  49. #define HY 0x20
  50. #define LX 0x40
  51. #define LY 0x60
  52.  
  53. #define LOWER5 31
  54. #define UPPER5 (31<<5)
  55.  
  56.  
  57. TEK40init()
  58. {
  59. }
  60.  
  61.  
  62. TEK40graphics()
  63. {
  64. #ifdef vms
  65.     term_pasthru();
  66. #endif /* vms */
  67.     fprintf(outfile,"\033\014");
  68. /*                   1
  69.     1. clear screen
  70. */
  71.     (void) fflush(outfile);
  72.     sleep(1);  
  73.     /* sleep 1 second to allow screen time to clear on real 
  74.        tektronix terminals */
  75. }
  76.  
  77. TEK40text()
  78. {
  79.     TEK40move(0,12);
  80.     fprintf(outfile,"\037");
  81. /*                   1
  82.     1. into alphanumerics
  83. */
  84. #ifdef vms
  85.     term_nopasthru();
  86. #endif /* vms */
  87. }
  88.  
  89.  
  90. TEK40linetype(linetype)
  91. int linetype;
  92. {
  93. }
  94.  
  95. TEK40move(x,y)
  96. unsigned int x,y;
  97. {
  98.     (void) putc('\035', outfile);    /* into graphics */
  99.     TEK40vector(x,y);
  100. }
  101.  
  102.  
  103. TEK40vector(x,y)
  104. unsigned int x,y;
  105. {
  106.     (void) putc((HY | (y & UPPER5)>>5), outfile);
  107.     (void) putc((LY | (y & LOWER5)), outfile);
  108.     (void) putc((HX | (x & UPPER5)>>5), outfile);
  109.     (void) putc((LX | (x & LOWER5)), outfile);
  110. }
  111.  
  112.  
  113. TEK40put_text(x,y,str)
  114. unsigned int x,y;
  115. char str[];
  116. {
  117.     TEK40move(x,y-11);
  118.     fprintf(outfile,"\037%s\n",str);
  119. }
  120.  
  121.  
  122. TEK40reset()
  123. {
  124. }
  125.  
  126. #endif /* TEK */
  127.  
  128.  
  129.  
  130. /* thanks to dukecdu!evs (Ed Simpson) for the BBN BitGraph driver */
  131.  
  132. #ifdef BITGRAPH
  133.  
  134. #define BG_XMAX                 768 /* width of plot area */
  135. #define BG_YMAX                 768 /* height of plot area */
  136. #define BG_SCREEN_HEIGHT    1024 /* full screen height */
  137.  
  138. #define BG_XLAST     (BG_XMAX - 1)
  139. #define BG_YLAST     (BG_YMAX - 1)
  140.  
  141. #define BG_VCHAR    16
  142. #define BG_HCHAR     9
  143. #define BG_VTIC         8
  144. #define BG_HTIC         8    
  145.  
  146.  
  147. #define BG_init TEK40init
  148.  
  149. #define BG_graphics TEK40graphics
  150.  
  151.  
  152. #define BG_linetype TEK40linetype
  153.  
  154. #define BG_move TEK40move
  155.  
  156. #define BG_vector TEK40vector
  157.  
  158.  
  159. BG_text()
  160. {
  161.     BG_move(0, BG_SCREEN_HEIGHT - 2 * BG_VCHAR);
  162.     fprintf(outfile,"\037");
  163. /*                   1
  164.     1. into alphanumerics
  165. */
  166. }
  167.  
  168.  
  169. BG_put_text(x,y,str)
  170. unsigned int x,y;
  171. char str[];
  172. {
  173.     BG_move(x,y-11);
  174.     fprintf(outfile,"\037%s\n",str);
  175. }
  176.  
  177.  
  178. #define BG_reset TEK40reset
  179.  
  180. #endif /* BITGRAPH */
  181.  
  182.  
  183. /* Color and Monochrome specials for the MS-DOS Kermit Tektronix Emulator
  184.    by Russell Lang,  eln272v@monu1.cc.monash.oz  */
  185.  
  186. #ifdef KERMIT
  187.  
  188. #define KTEK40HCHAR        13
  189.  
  190. KTEK40graphics()
  191. {
  192. #ifdef vms
  193.         term_mode_tek();
  194.     term_pasthru();
  195. #endif /* vms */
  196.     fprintf(outfile,"\033\014");
  197. /*                   1
  198.     1. clear screen
  199. */
  200.     /* kermit tektronix emulation doesn't need to wait */
  201. }
  202.  
  203. KTEK40Ctext()
  204. {
  205.     TEK40text();
  206.     KTEK40Clinetype(0);  /* change to green */
  207. #ifdef vms
  208.     term_nopasthru();
  209. #endif /* vms */
  210. }
  211.  
  212. /* special color linetypes for MS-DOS Kermit v2.31 tektronix emulator */
  213. /*    0 = normal, 1 = bright 
  214.     foreground color (30-37) = 30 + colors
  215.         where colors are   1=red, 2=green, 4=blue */
  216. static char *kermit_color[15]= {"\033[0;37m","\033[1;30m",
  217.         "\033[0;32m","\033[0;36m","\033[0;31m","\033[0;35m",
  218.         "\033[1;34m","\033[1;33m","\033[1;31m","\033[1;37m",
  219.         "\033[1;35m","\033[1;32m","\033[1;36m","\033[0;34m",
  220.         "\033[0;33m"};
  221.  
  222. KTEK40Clinetype(linetype)
  223. int linetype;
  224. {
  225.     if (linetype >= 13)
  226.         linetype %= 13;
  227.     fprintf(outfile,"%s",kermit_color[linetype+2]);
  228. }
  229.  
  230.  
  231. /* linetypes for MS-DOS Kermit v2.30 tektronix emulator */
  232. /* `=solid, a=fine dots, b=short dashes, c=dash dot, 
  233.    d=long dash dot, e=dash dot dot */
  234. static char *kerm_linetype = "`a`abcde" ;
  235.  
  236. KTEK40Mlinetype(linetype)
  237. int linetype;
  238. {
  239.     if (linetype >= 6)
  240.         linetype %= 6;
  241.     fprintf(outfile,"\033%c",kerm_linetype[linetype+2]);
  242. }
  243.  
  244. KTEK40reset()
  245. {
  246.     fprintf(outfile,"\030\n");  /* turn off Tek emulation */
  247. #ifdef vms
  248.     term_mode_native();
  249. #endif /* vms */
  250. }
  251.  
  252. #endif /* KERMIT */
  253.  
  254.  
  255. /* thanks to sask!macphed (Geoff Coleman and Ian Macphedran) for the
  256.    Selanar driver */
  257.  
  258. #ifdef SELANAR
  259.  
  260. SEL_init()
  261. {
  262.     fprintf(outfile,"\033\062");
  263. /*                    1
  264.     1. set to ansi mode
  265. */
  266. }
  267.  
  268.  
  269. SEL_graphics()
  270. {
  271.     fprintf(outfile,"\033[H\033[J\033\061\033\014");
  272. /*                   1           2       3
  273.     1. clear ANSI screen
  274.     2. set to TEK mode
  275.     3. clear screen
  276. */
  277. }
  278.  
  279.  
  280. SEL_text()
  281. {
  282.     TEK40move(0,12);
  283.     fprintf(outfile,"\033\062");
  284. /*                   1
  285.     1. into ANSI mode
  286. */
  287. }
  288.  
  289. SEL_reset()
  290. {
  291.     fprintf(outfile,"\033\061\033\012\033\062\033[H\033[J");
  292. /*                   1        2       3      4
  293. 1       set tek mode
  294. 2       clear screen
  295. 3       set ansi mode
  296. 4       clear screen
  297. */
  298. }
  299. #endif /* SELANAR */
  300.  
  301. #ifdef VTTEK
  302.  
  303. VTTEK40init()
  304. {
  305.         fprintf(outfile,"\033[?38h");
  306.         fflush(outfile);
  307.         sleep(1);
  308.         /* sleep 1 second to allow screen time to clear on some terminals */
  309. #ifdef vms
  310.         term_mode_tek();
  311. #endif /* vms */
  312. }
  313.  
  314. VTTEK40reset()
  315. {
  316.         fprintf(outfile,"\033[?38l");
  317.         fflush(outfile);
  318.         sleep(1);
  319.         /* sleep 1 second to allow screen time to clear on some terminals */
  320. #ifdef vms
  321.         term_mode_native();
  322. #endif /* vms */
  323. }
  324.  
  325. /* linetypes for VT-type terminals in tektronix emulator mode */
  326. /* `=solid, a=fine dots, b=short dashes, c=dash dot,
  327.    d=long dash dot, h=bold solid, i=bold fine dots, j=bold short dashes,
  328.    k=bold dash dot, l=bold long dash dot */
  329. static char *vt_linetype = "`a`abcdhijkl" ;
  330. static int last_vt_linetype = 0;
  331. VTTEK40linetype(linetype)
  332. int linetype;
  333. {
  334.         if (linetype >= 10)
  335.                 linetype %= 10;
  336.         fprintf(outfile,"\033%c",vt_linetype[linetype+2]);
  337.         last_vt_linetype = linetype;
  338. }
  339.  
  340. VTTEK40put_text(x,y,str)
  341. unsigned int x,y;
  342. char str[];
  343. {
  344.         int linetype;
  345.         linetype = last_vt_linetype;
  346.         VTTEK40linetype(0);
  347.         TEK40put_text(x,y,str);
  348.         VTTEK40linetype(linetype);
  349. }
  350.  
  351. #endif /* VTTEK */
  352.  
  353. #ifdef LN03P
  354.  
  355. LN03Pinit()
  356. {
  357.     fprintf(outfile,"\033[?38h");
  358. }
  359.  
  360. LN03Preset()
  361. {
  362.     fprintf(outfile,"\033[?38l");
  363. }
  364. #endif /* LN03P */
  365.